package cn.dankal.flyaudio.personal;

import android.text.TextUtils;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import androidx.appcompat.widget.AppCompatTextView;
import androidx.recyclerview.widget.RecyclerView;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.pojo.CreateOrderPreviewEntity;
import cn.dankal.basiclib.pojo.LogisticsEntity;
import cn.dankal.flyaudio.R;
import cn.dankal.flyaudio.adapter.LogisticsAdapter;

/**
 * <pre>
 *     e-mail : junfeng.nie@duntech.com.cn
 *     time   : 24/7/2020
 *     desc   :
 *     version: cn.dankal.flyaudio.personal
 *     Copyright: Copyright（c）2018
 *     Company:
 * </pre>
 *
 * @author niejunfeng
 */
public class NegotiationHistoryActivity extends BaseActivity {
    @Override
    protected int getLayoutId() {
        return R.layout.activity_negotiation_history;
    }

    LogisticsAdapter logisticsAdapter;

    @Override
    protected void initComponents() {


        CreateOrderPreviewEntity orderDetail = (CreateOrderPreviewEntity) getIntent().getSerializableExtra("model");


        //WAITING,//申请中
        //REJECTED,//已拒绝
        //WAITING_SHIP,//商家已同意, 等待用户发货
        //SHIPPING,//商家已同意, 等待收货
        //WAITING_REFUND,//商家已收货, 退款中
        //REFUND_SUCCESS,//退款成功, 订单关闭
        String position = "0";
        logisticsAdapter = new LogisticsAdapter(position);

        RecyclerView recyclerView = findViewById(R.id.mRv);
        recyclerView.setAdapter(logisticsAdapter);
        List<LogisticsEntity> logisticsEntities = new ArrayList<>();
        for (int i = orderDetail.getOperationRecordList().size()-1; i>=0;i--){
            logisticsEntities.add(orderDetail.getOperationRecordList().get(i));
        }

        logisticsAdapter.addDatas(logisticsEntities,true);
        AppCompatTextView textView = findViewById(R.id.tv_content);
        textView.setText(orderDetail.getAfterSaleApply().getUserReason());


        findViewById(R.id.iv_onback).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }
}
